package aupdg.data.model;

import java.util.List;

/**
 * Contract of an LDG.
 *
 * @author AA and CJ
 */
public interface Ldg {

    /**
     * Returns LDG's entry node.
     *
     * @return
     */
    public Node getEntryNode();

    /**
     * Returns list of transition-nodes.
     *
     * @return
     */
    public List<Node> getTransitionNodes();

    /**
     * Returns list of if-nodes.
     *
     * @return
     */
    public List<Node> getIfNodes();

    /**
     * Returns list of predicate-nodes.
     *
     * @return
     */
    public List<Node> getPredicateNodes();

    /**
     * Returns list of control dependence edges.
     *
     * @return
     */
    public List<Edge> getControlDepEdges();

    /**
     * Returns list of data dependence edges.
     *
     * @return
     */
    public List<Edge> getDataDepEdges();

    /**
     * Adds a node to the LDG.
     *
     * @param node
     */
    public void addNode(Node node);

    /**
     * Adds an edge to the LDG.
     *
     * @param sourceId
     * @param edge
     */
    public void addEdge(int sourceId, Edge edge);

    /**
     * Returns a list of node IDs.
     *
     * @return
     */
    public List<Integer> getNodeIds();

    /**
     * Returns an LDG node by its ID.
     *
     * @param id
     * @return
     */
    public Node getNode(int id);

    /**
     * Given a node returns all edges in which the node is the source node.
     *
     * @param sourceNode
     * @return
     */
    public List<Edge> getAdjacentEdgesFromNode(Node sourceNode);

    /**
     * Returns all edges represented as a list of list of edges.
     *
     * @return
     */
    public List<List<Edge>> getAdjacentEdges();

    /**
     * Returns a string representation of the LDG.
     *
     * @return
     */
    public boolean asString();

    /**
     * Returns a string representation of the LDG by overriding the Object
     * method.
     *
     * @return
     */
    @Override
    public String toString();
}
